#include <iostream>
using namespace std;

class Complex
{
private:
    double _real;
    double _image;
public:
    Complex();
    Complex(double r, double i); // 构造函数
    Complex(const Complex& x); // 拷贝构造

    double getReal() const {
        return _real;
    }

    void setReal(double d) {
        _real = d;
    }

    double getImage() const {
        return _image;
    }

    void setImage(double d) {
        _image = d;
    }

    // 运算符重载
    Complex operator+ (const Complex& d);
    Complex& operator= (const Complex& d);

    Complex& operator++ (); // ++前置 
    Complex operator++ (int); // 后缀 ++

    friend ostream& operator<<(ostream& os, const Complex &x);
    // friend istream& operator>>(istream& is, Complex &x);
};

Complex::Complex(double r, double i)
{
    _real = r;
    _image = i;
}

Complex::Complex()
{
    _real = 0.0;
    _image = 0.0;
}

Complex Complex::operator+ (const Complex& d)
{
    Complex temp;
    temp._real = _real + d._real;
    temp._image = _image + d._image;
    return temp;
}

Complex& Complex::operator= (const Complex& d) {
    if (this != &d)
    {
        _real = d._real;
        _image = d._image;
    }
    return *this;
}

Complex::Complex(const Complex& x) {
    _real = x._real;
    _image = x._image;
}

Complex& Complex::operator++ () // aa ++
{
    _real++;
    _image++;
    return *this;
}

Complex Complex::operator++ (int) //  ++ aa
{
    Complex temp(*this);
    _real++;
    _image++;
    return temp;
}

ostream& operator<<(ostream& os, const Complex &x)
{
	os << "real value is  " << x._real << "  image value is " << x._image;
	return os;
}

// istream& operator >> (istream& is, Complex &x)
// {
// 	is >> x._real >> x._image;
// 	return is;
// }